<template>
      <div id="score">
            <el-dialog
            :title="ScoreData.title"
            :visible.sync="ScoreData.show"
            width="60%"
            >
            <div class="form">
                  <el-form label-width="150px">
                        <el-form-item label="卡号">
                              <el-input v-model="UserData.cardnum" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="积分">
                              <el-input v-model.number="UserData.score"></el-input>
                        </el-form-item>
                  </el-form>
            </div>
            <span slot="footer" class="dialog-footer">
            <el-button @click="ScoreData.show = false">取 消</el-button>
            <el-button type="primary" @click="subForm">确 定</el-button>
            </span>
            </el-dialog>

      </div>
</template>

<script>
      export default {
            props: {
                  ScoreData: Object,
                  UserData: Object
            },
            methods: {
                  
                  async subForm() {
                        this.UserData.token = localStorage.miniToken
                        let res = await this.$axios.post("/admin/user/scorechange", this.UserData)
                        //console.log(res);
                        let code = res.data.code
                        if (code == 204) {
                              this.$message.success("积分更新成功!")
                              this.ScoreData.show = false
                              this.$emit("update")
                        } else {
                              this.$message.error("积分更新失败,请重试!")
                              this.ScoreData.show = false
                              this.$emit("update")
                        }
                        
                  }
            },
      }
</script>

<style lang="scss" scoped>

</style>